// 引入react
import * as React from 'react';
import {StyleSheet, View, Text, Dimensions,TouchableOpacity} from 'react-native';

/**
 * @Description:
 * @author TangYong
 * @date 2022/12/16
 */
export class BottomButton extends React.Component {
    constructor(props) {
        super(props);
        this.state = {
        };
    }
    //生命周期：组件挂载后
    componentDidMount() {
    }

    //方法
    //这是复杂写法
    // sendMsg=(name)=>{
    //     //回调父组件方法
    //     console.log('name----------------',name);
    //     this.props.click(name)
    // }
    //DOM
    render() {
        return (
            <View style={style.bottom}>
                {/*这是复杂写法*/}
                {/*<TouchableOpacity*/}
                {/*    style={style.button}*/}
                {/*    onPress={()=>this.sendMsg(this.props.title)}*/}
                {/*>*/}
                {/*这是简单写法*/}
                <TouchableOpacity
                    style={style.button}
                    onPress={this.props.click}
                >
                    <Text style={style.buttonText}>{this.props.title}</Text>
                </TouchableOpacity>
            </View>
        )
    }

}
const width=Dimensions.get('window').width
const style = StyleSheet.create({
    //样式
    button: {
        alignItems: 'center',
        justifyContent: 'center',
        backgroundColor: '#409EFF',
        height: 40,
        borderRadius: 12,
    },
    bottom: {
        padding: 10,
        width: width,
        backgroundColor: '#fff',
    },
    buttonText: {
        color: '#FEFEFE',
        fontWeight:"500",
        fontSize:16,
    },
})
